﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Shsc.Net.FrameWork.Dao.Base;
using Shsc.Net.FrameWork.Entity.Base;
using Shsc.Net.FrameWork.Dto.Home;
using Shsc.Net.FrameWork.Common.Util;
using Shsc.Net.FrameWork.Common.SysException;

namespace Shsc.Net.FrameWork.Logic.Home.Impl
{
    public class LoginLogicImpl : ILoginLogic
    {

        public IMsUserDao MsUserDao { get; set; }

        #region ILoginLogic 成员

        public bool CheckLoginInfo(LoginDto loginDto)
        {
            MsUserEntity msUserEntity = new MsUserEntity();
            msUserEntity.LoginUserId = loginDto.LoginUserId;
            msUserEntity = (MsUserEntity)MsUserDao.SelectByKey(msUserEntity);
            if (msUserEntity == null)
            {
                throw new BusinessException();
            }
            else
            {
                if (msUserEntity.Password != CryptographyUtil.MD5Cryptography(loginDto.PassWord))
                {
                    throw new BusinessException();
                }
            }
            return true;
        }

        #endregion
    }
}
